package leetcode_core.leetcode_1;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class TwoSum2 {
    Set<Integer> sum = new HashSet<>();
    List<Integer> nums = new ArrayList<>();
    public void add(int number){
        //记录所有可能组成的和
        for (Integer n : nums) {
            sum.add(n+number);
        }
        nums.add(number);
    }
    public boolean find(int value){
        return sum.contains(value);
    }



}
